<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * Define the application's command schedule.
     *
     * @param \Illuminate\Console\Scheduling\Schedule $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        //$schedule->command('horizon:snapshot')->everyFiveMinutes();
        // 同步设备在线状态
        $schedule->command('sync-device-state')->withoutOverlapping()->everyTenMinutes();
        // 删除已关闭的订单
        $schedule->command('delete-closed-order')->withoutOverlapping()->dailyAt('02:00');
        // 回收领券记录
        $schedule->command('sync-merchant')->withoutOverlapping()->dailyAt('00:30');
        // 删除已过期节假日
        $schedule->command('delete-expired-holiday')->withoutOverlapping()->dailyAt('00:10');

        // 归档数据
        $schedule->command('archive-data')->withoutOverlapping()->dailyAt('01:30');
    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__ . '/Commands');

        require app_path('Routes/console.php');
    }
}
